﻿using Mes.Domain.BoundedContext;

namespace Mes.Application.DTO.Inputs.Quality
{
    public class QmSpecCommon
    {
        /// <summary>
        /// 质量规格名称
        /// </summary>
        public string Qm_Spec_Name { get; set; } = string.Empty;

        /// <summary>
        /// 质量规格描述
        /// </summary>
        public string? Qm_Spec_Desc { get; set; } = null;

        /// <summary>
        /// 编辑级别
        /// </summary>
        public int Edit_Level { get; set; } = 0;

        /// <summary>
        /// 版本
        /// </summary>
        public string Ver_Id { get; set; } = string.Empty;

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime Start_Eff_Local { get; set; } = DateTime.Now;

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? End_Eff_Local { get; set; } = null;

        /// <summary>
        /// 生产单元
        /// </summary>
        public int? Ent_Id { get; set; } = null;

        /// <summary>
        /// 采样计划名称
        /// </summary>
        public int? Plan_Id { get; set; } = null;

        /// <summary>
        /// 每页点数
        /// </summary>
        public int? Num_Pts_Per_Page { get; set; } = null;

        /// <summary>
        /// 显示顺序
        /// </summary>
        public int Display_Seq { get; set; } = 0;
    }

    public class QmSpecCharacteristic
    {
        /// <summary>
        /// 关联特性Id
        /// </summary>
        public int CharacteristicId { get; set; }

        /// <summary>
        /// 目标
        /// </summary>
        public double Target { get; set; } = 0;

        /// <summary>
        /// 规格上限
        /// </summary>
        public double? Usv { get; set; } = null;

        /// <summary>
        /// 规格下限
        /// </summary>
        public double? Lsv { get; set; } = null;
    }

    public class QmSpecAddingInput : QmSpecCommon
    {
        /// <summary>
        /// 质量规格链接的特性
        /// </summary>
        public List<QmSpecCharacteristic> QmSpecChars { get; set; }

        /// <summary>
        /// SPC规则ID列表
        /// </summary>
        public List<int> SpcRuleIds { get; set; } = new List<int>();
    }

    public class QmSpecUpdatingInput : QmSpecAddingInput
    {
        /// <summary>
        /// 质量规格id
        /// </summary>
        public int Qm_Spec_Id { get; set; } = 0;
    }

    public class QmSpecPagedInput
    {
        /// <summary>
        /// 查询关键字(质量规格名称)
        /// </summary>
        public string? KeyWord { get; set; }

        /// <summary>
        /// 分页参数
        /// </summary>
        public PagedInput PagedInput { get; set; } = new PagedInput();
    }
}
